//
//  OneBaseRootViewController.m
//  oneCommonLib
//
//  Created by SY on 2025/6/23.
//

#import "OneBaseRootViewController.h"
#import "MSUserManager.h"

#import "OneChatModelUtil.h"
#import <Masonry/Masonry.h>

@interface OneBaseRootViewController ()

@end

@implementation OneBaseRootViewController

- (void)loadView {

    OneChatSetModel*chatSetModel = [OneChatModelUtil checkLocalChatSetModel:@""];
    if (chatSetModel == nil || chatSetModel.ordinary.screencap==NO) {
        [super loadView];
        return;
    }
    
    OneScreenShieldView *containerView = [OneScreenShieldView createWithFrame:UIScreen.mainScreen.bounds];
    self.screenShieldView = containerView;
    
    Class childClass = [self class];
    NSString *className = NSStringFromClass(childClass);
    // 检查子类是否有对应的XIB文件
    NSBundle *bundle = [NSBundle bundleForClass:childClass];
    if ([bundle pathForResource:className ofType:@"nib"] != nil) {
        [bundle loadNibNamed:className owner:self options:nil];
        
        if (self.view) {
            UIView *xibView = self.view;
            
            //            xibView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
            [containerView addSubview:xibView];
            [xibView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(containerView);
            }];
            self.view = containerView;
            return;
        }
    }
    self.view = containerView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

@end
